package com.lagou.rpc.consumer.Controller;

import com.lagou.rpc.api.IOrderService;
import com.lagou.rpc.consumer.proxy.RpcClientProxy;
import com.lagou.rpc.pojo.Order;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    private IOrderService orderService = (IOrderService) RpcClientProxy.createProxy(IOrderService.class);


    @RequestMapping("/get")
    public List<Order> getOrderByUserId(Integer uid) {
        List<Order> orders = orderService.getOrderByUserId(uid);
        System.out.println(orders);
        return orders;
    }
}
